public class TestSchedulerClass{
/*
        static testMethod void testApexSchedulerSendMessage() {
              
            Test.startTest();
            ApexSchedulerSendMessage bc = new ApexSchedulerSendMessage();  
            String sch = '0 0 23 * * ?';
            String jobId = System.schedule('testApexSchedulerSendMessage', sch, bc); 
            Test.stopTest();   
            
        }
*/        
        static testMethod void testAutoDeleteMedicalDashboard() {
            AutoDeleteMedicalDashboard cc = new AutoDeleteMedicalDashboard();    
        
            Test.startTest();
            String cch = '0 0 23 * * ?';
            String jobId1 = System.schedule('testAutoDeleteMedicalDashboard', cch, cc); 
            Test.stopTest();   
                  
        }
/*        
        static testMethod void testCreateHCPCallCorverAndFrequency() {
        
            CreateHCPCallCorverAndFrequency dc = new CreateHCPCallCorverAndFrequency();    
            
            Test.startTest();
            String ech = '0 0 23 * * ?';
            String jobId1 = System.schedule('testCreateHCPCallCorverAndFrequency', ech, dc);   
            Test.stopTest();      
             
        } 
 */      
    /*    static testMethod void testDistributionPointScheduler() {
            DistributionPointScheduler ec = new DistributionPointScheduler();    
            
            Test.startTest();
            String ech = '0 0 23 * * ?';
            String jobId1 = System.schedule('testDistributionPointScheduler', ech, ec);
            Test.stopTest();
             
        }     */    
  
        static testMethod void testCreateDashboardScheduler() {
            CreateDashboardScheduler dc = new CreateDashboardScheduler();    
            
            Test.startTest();
            String ech = '0 0 23 * * ?';
            String jobId1 = System.schedule('testCreateDashboardScheduler', ech, dc);   
            Test.stopTest();      
             
        }   
      /*
        static testMethod void testOptimizeTriggerScheduler() {
            OptimizeTriggerScheduler dc = new OptimizeTriggerScheduler();    
            
            Test.startTest();
            String ech = '0 0 23 * * ?';
            String jobId1 = System.schedule('testOptimizeTriggerScheduler', ech, dc);   
            Test.stopTest();
             
        }   */          
/*          
        static testMethod void testCoverageAverageproduceline() {
        
            Product2 ps=new Product2();
            ps.Name='testProduct';
            insert ps;
            
            Account acc=new Account();
            acc.Name='test';
            acc.Channel__c='百货店';
            acc.Contact__c='aaa';
            acc.No_of_checkout__c=22;
            acc.ContactPhoneNumber__c='1234567456';
            insert acc;
            
            Distributor__c dis=new Distributor__c(Distributor_Code__c='wwwwwww',Name='test',Fax__c='111111',Address__c='ddddd',Phone__c='123344',Accepted_Order_Way__c='Fax',Email__c='aa@aa.com');
            insert dis;
            
            Distributor__c dis2=new Distributor__c(Distributor_Code__c='dddd',Name='test',Fax__c='111111',Address__c='ddddd',Phone__c='123344',Accepted_Order_Way__c='Email',Email__c='aa@aa.com');
            insert dis2;
            
            Routing_Plan_And_Visit__c tr=new Routing_Plan_And_Visit__c(Visit_Date__c=Date.today().addMonths(1));
            insert tr;
            
            RoutingPlan__c rp=new RoutingPlan__c();
            rp.RoutingPlanAndVisit__c=tr.Id;
            rp.OutletName__c=acc.Id;
            Date d=tr.Visit_Date__c;
            rp.StartDateTime__c=DateTime.newInstance(d.year(),d.month(),d.day(),8,8,8);
            rp.EndDateTime__c=DateTime.newInstance(d.year(),d.month(),d.day(),9,9,9);
            insert rp;
            
            In_Store_Visit__c vi=new In_Store_Visit__c();
            vi.RoutingPlanAndVisit__c=tr.Id;
            vi.OutletName_del__c=acc.Id;
            vi.Start_Time__c=DateTime.newInstance(d.year(),d.month(),d.day(),8,8,8);
            vi.End_Time__c=DateTime.newInstance(d.year(),d.month(),d.day(),9,9,9);
            vi.Main_Shelf_Facing__c=22;
            insert vi; 
            
            User tsr = [Select id from User Where IsActive =: True and FunctionDepartment__c =:  'Trade Sales' and Title__c =: 'Sales Rep' limit 1];       
            
            TradeDashboardDetails__c tdd = new TradeDashboardDetails__c(TSR__c = tsr.id,Outlet__c = acc.Id);
            insert tdd;
        
        
            CoverageAverageproduceline dc = new CoverageAverageproduceline();
            
            Test.startTest();
            String ech = '0 0 23 * * ?';
            String jobId1 = System.schedule('testCoverageAverageproduceline', ech, dc);   
            Test.stopTest();
             
        }   
*/        
        static testMethod void testAddRecordToOutletMonthlyOfftakeScheduler() {
            List<Inventory__c> updateList = [Select id,HasRunForOutletMonthlyOfftake__c From Inventory__c Where HasRunForOutletMonthlyOfftake__c =: false limit 10]; 
            for(Inventory__c inv : updateList)
            {
                inv.HasRunForOutletMonthlyOfftake__c = true;
            }
            update updateList;      
            
            List<Inventory__c> insertList = new List<Inventory__c>();
            In_Store_Visit__c isv = [Select id From In_Store_Visit__c limit 1];
            for(integer i = 0; i<100; i++){
                Inventory__c inv = new Inventory__c(HasRunForOutletMonthlyOfftake__c = false, In_Store_Visit__c = isv.id);
                insertList.add(inv);
            }
            insert insertList;
      
            Test.startTest();
                        
            AddRecordToOutletMonthlyOfftakeScheduler dc = new AddRecordToOutletMonthlyOfftakeScheduler();   
            ID batchprocessid = Database.executeBatch(dc);
            
            Test.stopTest();
            system.debug('*************'+batchprocessid );
             
        }                  
    }